package cards;

/**
 * @class Card represents one card of a deck
 * @author vlada
 */
public class Card {
    
    /**
     * Suit of the card
     */ 
    private final Suit suit;
    
    /**
     * Rank of the card
     */
    private final Rank rank;
    
    /**
     * Constructor
     * @param cardSuit
     * @param cardRank 
     */
    public Card(Suit cardSuit, Rank cardRank) {
        this.suit = cardSuit;
        this.rank = cardRank;
    }

    /**
     * Suit of the card
     * @return the suit
     */
    public Suit getSuit() {
        return suit;
    }

    /**
     * Rank of the card
     * @return the rank
     */
    public Rank getRank() {
        return rank;
    }
    
    @Override
    public boolean equals(Object obj) {
       if (obj instanceof Card) {
           Card otherCard = (Card) obj;
           if (this.rank.equals(otherCard.getRank()) && this.suit.equals(otherCard.getSuit()) ) {
               return true;
           }
       }
       return false;
    }
    
    @Override
    public String toString() {
        return suit + " " + rank;
    }
    
    
}
